UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YVrwnMyLjaGAOGUzTdQOO+Z8gai/URTcVaT17h7vHw4=' 
WHERE 
  key_id = 'abe16e633161ab13034e0da3139a463819de6d144fca025acbced37e620f192d' 
  AND (
    token = 'YVrwnMyLjaGAOGUzTdQOO+Z8gai/URTcVaT17h7vHw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063