UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KaGHGn52w4jOssWYem/JNboNHwtzLgsb8K2fu5G4yk4='
WHERE
key_id = 'b518f9f1db83a76a4281f0c99df976a5c1b386d6dcd1c4bc927087675f929203'
AND (
token = 'KaGHGn52w4jOssWYem/JNboNHwtzLgsb8K2fu5G4yk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)