UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4fHh2qDgWvx8anFVUmrghoZjdOsnOzAHmb6r/Bl+1ck=' 
WHERE 
  key_id = '4bf08b9b84134374a2039e174ea62f8e18c52dd8c596040a5c18c802859f6be0' 
  AND (
    token = '4fHh2qDgWvx8anFVUmrghoZjdOsnOzAHmb6r/Bl+1ck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046