UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JHHZQpCRcdbuZwFfv2k1UhQHI3C19NsuZJvvvoblkdo=' 
WHERE 
  key_id = '37bfb1d052addb7503534126b14b3ba85f5f1679cbb200216d979622c670e8e4' 
  AND (
    token = 'JHHZQpCRcdbuZwFfv2k1UhQHI3C19NsuZJvvvoblkdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031