UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6PWZFoIA4mTV4RZ7D+wex7CULhZ9xUCf+BsgzKx6Gn0='
WHERE
key_id = '380c56f540740c336fe8c7eb02410dc1737e12381fee102e381e7b3132af9abc'
AND (
token = '6PWZFoIA4mTV4RZ7D+wex7CULhZ9xUCf+BsgzKx6Gn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)