UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ye+p+z9e/EZj7tEaQEAlccvv/w9XFbwBmBHE+kloKx0=' 
WHERE 
  key_id = '72138e257742b37e11b6a005eaa9d492c57649dc3f1823d275ab383e099dc73f' 
  AND (
    token = 'Ye+p+z9e/EZj7tEaQEAlccvv/w9XFbwBmBHE+kloKx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044