UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JmdVGmOqwss436w6y0ACf+qQGKTrzqjGALkCTtIpHyM=' 
WHERE 
  key_id = '33f5278cddbd69b3372c2aac0078af0e02b0fc7a3bb4773cc3bea064f9239895' 
  AND (
    token = 'JmdVGmOqwss436w6y0ACf+qQGKTrzqjGALkCTtIpHyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045