UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YbkAbv09Y0c0j6+ItWI6vWmaEd5X2gYksALcZaW90o0='
WHERE
key_id = 'a9c90d56e5bd6044dee6827101f04c8c311f9df6113ab474ebfcb088b10ec49d'
AND (
token = 'YbkAbv09Y0c0j6+ItWI6vWmaEd5X2gYksALcZaW90o0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)