UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kx+4E8NMheYGmvTztp14vw5E4B6ZIJcSsaoqAmblQ/Y='
WHERE
key_id = 'e8eafcc684aa996cd2c2e5630cbeed60acb174bf932c176e3d8520486167040c'
AND (
token = 'Kx+4E8NMheYGmvTztp14vw5E4B6ZIJcSsaoqAmblQ/Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)