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