UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XIwBo8CJ6C0MuLjYbkjiFHvMTyN371lZCI1M2Lkvnqg='
WHERE
key_id = '6323912faef0728306f8ab8eb510a53faec214be8f7f2b83e82ad7ede83dc354'
AND (
token = 'XIwBo8CJ6C0MuLjYbkjiFHvMTyN371lZCI1M2Lkvnqg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)