UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D6CI5wS2L4yUewrj+J4bIuFTXoPmUyG1qXnFUjPhOOU=' 
WHERE 
  key_id = '12a8619560cf0c09e76eb6e9547d4057c60c364c38ed601fbfd4593e7a816c98' 
  AND (
    token = 'D6CI5wS2L4yUewrj+J4bIuFTXoPmUyG1qXnFUjPhOOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035