UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'soi1Wo1ZqQ0aWetIFNx6rVFmGaz4FfV+OCKcSSFdtBI=' 
WHERE 
  key_id = '557e0b3e5261e9e3da0f81ccc7b8e3257097603aab505be99759d802ce27c9fb' 
  AND (
    token = 'soi1Wo1ZqQ0aWetIFNx6rVFmGaz4FfV+OCKcSSFdtBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041