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