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