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