UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GS34nLUEn6A6vAUanVpzhgS1Ak5y+ETTrIfAQ4QeJ60=' 
WHERE 
  key_id = '508da66a537f76655270d2a86a69460a610d609f9ff2d7c6cb87fec48fc38d9f' 
  AND (
    token = 'GS34nLUEn6A6vAUanVpzhgS1Ak5y+ETTrIfAQ4QeJ60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030