UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZqtBzMpPjOL2IQDja7J9le3TohF+dspXXD97K8+1iqk='
WHERE
key_id = '1d6bf6f339c8efab406e3e802557704f05a8c19cdd273c7daa2190c02108f2cf'
AND (
token = 'ZqtBzMpPjOL2IQDja7J9le3TohF+dspXXD97K8+1iqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)