UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8O+uo8jAHqFHQhTPU6E6gKZlNhUr0ePZI9tZWdC1czY='
WHERE
key_id = '9938e4f40a10d6ea82301a69985f2a73dc34daaad81c3fc63140279453ae2563'
AND (
token = '8O+uo8jAHqFHQhTPU6E6gKZlNhUr0ePZI9tZWdC1czY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)