UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QNzb0+dh7qsv6OCYfWxzIvGzUXgvKQHtr5wim0aDLjo=' 
WHERE 
  key_id = '0cf58a73c517acdf6af480eed9466b7fe3d0c6045d7640a7c33b801f1aa6916d' 
  AND (
    token = 'QNzb0+dh7qsv6OCYfWxzIvGzUXgvKQHtr5wim0aDLjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021