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

Query time 0.00029