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