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