UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BjImXiOuGA0BxVDFNGtqeRrVLxAVk6v3pfISI1VMZWw='
WHERE
key_id = 'cea3984b76ef0cbb0c19ae1ad85843a79ccc0253f3259d8d86a45298d75f96bd'
AND (
token = 'BjImXiOuGA0BxVDFNGtqeRrVLxAVk6v3pfISI1VMZWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)