UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+zeLO7mkGFLZRD5jAOjJHduDRrn7pTQofBfnMyAlAw=' 
WHERE 
  key_id = 'd7a2c7f14819dfb056e644bcb09e47a5dd787884d31c8bc1aad8509b78400ad4' 
  AND (
    token = 'D+zeLO7mkGFLZRD5jAOjJHduDRrn7pTQofBfnMyAlAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025