UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6tnSuLMYQYSnB2yXTNWzqwFt9eHOB1D/9d++jeWcck='
WHERE
key_id = '0c5bd339651511af2eae21f255304dd1530fd320a92d087037f515a155a2d95f'
AND (
token = 'S6tnSuLMYQYSnB2yXTNWzqwFt9eHOB1D/9d++jeWcck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)