UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3mt5aopIwsEMNNSevbIjTR5Jhuj3zOVLavxZ+R5wC3U='
WHERE
key_id = '129c54a3a5af3a532337a9fe62df9100a613ed86053a3995fc2cb7ff781f4276'
AND (
token = '3mt5aopIwsEMNNSevbIjTR5Jhuj3zOVLavxZ+R5wC3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)