UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1B07QMCJ6BS0gV3TIckA/veAI4am8px6BsJAjVSwGII=' 
WHERE 
  key_id = '324902c078d649b6de6b2a87d7e0b44ff90381e747e86bf870c8b2e714e6faa3' 
  AND (
    token = '1B07QMCJ6BS0gV3TIckA/veAI4am8px6BsJAjVSwGII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019