UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8PLAt0AtplZ1xyNvD1h31D/tBA51txTf9Ej4nOCwpRI='
WHERE
key_id = 'cbd6c95bef916d093284a032f2761b37da55229a302001fd87ad4854dfd0cf15'
AND (
token = '8PLAt0AtplZ1xyNvD1h31D/tBA51txTf9Ej4nOCwpRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)