UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oh6viPh7uJdqH6eooipUI5vXAATx0MRzBHNjVPcDs0U='
WHERE
key_id = '474186cf539c0d8633a225e88c3b7649b4e2aba8690137c1d01afac1e4c120ea'
AND (
token = 'oh6viPh7uJdqH6eooipUI5vXAATx0MRzBHNjVPcDs0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)