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