UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JVAMkZ8yxhCK3cHHHn7hLZcxTurWhiVzAErDPh1Fdgk=' 
WHERE 
  key_id = 'a504b961ddb538c0fe246d085f892671ceb8c0d096d7d5cfeb9d84f35ae8bb62' 
  AND (
    token = 'JVAMkZ8yxhCK3cHHHn7hLZcxTurWhiVzAErDPh1Fdgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021