UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BYI1XcveOR23o6FGUsdte35u3ELmDi8iXVNan6jB91w='
WHERE
key_id = '31f5b466602b95205812d921cf9f13336a2010da6faba2a841d14821bb9d7fcf'
AND (
token = 'BYI1XcveOR23o6FGUsdte35u3ELmDi8iXVNan6jB91w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)