UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+qki6uOv7eZCZCXhBcjmTk62GpEdzyFW61+IJqEDIfk='
WHERE
key_id = 'ffc5f4a2415aeac1126fbc5bf1f08c1aa2c0e4bcce9ff9af0e29d12ba37202a1'
AND (
token = '+qki6uOv7eZCZCXhBcjmTk62GpEdzyFW61+IJqEDIfk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)