UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hTe5bNSW86MytQtcKPODh97hieerN4917fp+6UvzB1g=' 
WHERE 
  key_id = '024356aa1f0a86d34b30cb3023fb72ede8c5da07ad1e8f54238201b1f42dd7f9' 
  AND (
    token = 'hTe5bNSW86MytQtcKPODh97hieerN4917fp+6UvzB1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045