UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kbzyv0vB7Qgu294OHKOWeRg2gNaN9YQ51dfIZqHUbT4=' 
WHERE 
  key_id = '429cb7d7cf2cc915eba386d2297a6b6a53d41f135b1186a1b0e5b2477c7d2058' 
  AND (
    token = 'kbzyv0vB7Qgu294OHKOWeRg2gNaN9YQ51dfIZqHUbT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080