UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/fHkO1J8dSwK1NUTBhUedixlCqxNGJvdbBweXIDys8o='
WHERE
key_id = 'e7b3607c7e660efea6fbb28dde0cd9a1de46aff699b60137eaf4688255fb95cb'
AND (
token = '/fHkO1J8dSwK1NUTBhUedixlCqxNGJvdbBweXIDys8o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)