UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4PQJ7AR93a1YqXRqZFcjOt9UYZM8OlE1+VczRTwu2E=' 
WHERE 
  key_id = '512e62261360d1aecbcb0540a5a07cc45894afc3e2f00af508a2e9eadaad18c1' 
  AND (
    token = 'U4PQJ7AR93a1YqXRqZFcjOt9UYZM8OlE1+VczRTwu2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026