UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tHz0Q1j0KnHwsam+NCQYvSv4LxcH4ZVdDlnzg1mPcaM='
WHERE
key_id = '23d7a56902fc0554d81df3dad4da9164f343d9bc639449d65872e2f3f271807d'
AND (
token = 'tHz0Q1j0KnHwsam+NCQYvSv4LxcH4ZVdDlnzg1mPcaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)