UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iLV40NvPi+JxXK3KGsUxvEs7AralZ9wnCrzGTADGuec='
WHERE
key_id = 'd167753b23699252bb516066a7eb4bd15683c9a6954cc426753eb139fd2ad991'
AND (
token = 'iLV40NvPi+JxXK3KGsUxvEs7AralZ9wnCrzGTADGuec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)