UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+kMklz9RF5aQHJhCeT6xFU3Mz/8fk83lVddhws2yQw='
WHERE
key_id = 'd24c1b85693bc76d8610ac832fdfe0a0d7fb304cc25abe1db062b65e181bec43'
AND (
token = 'N+kMklz9RF5aQHJhCeT6xFU3Mz/8fk83lVddhws2yQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)